package edu.gyc.data.struct.sparsearray;

import java.util.LinkedList;

public class MyYsf {
    public static void ysf(int n, int k, int start) {
        LinkedList<Integer> linkedList = new LinkedList<>();
        for (int i = 0; i < n; i++) {
            linkedList.addLast(i+1);
        }
        int p=start-1;
        while (linkedList.size() > 0) {
            p=(p+k-1)%linkedList.size();
            int t = linkedList.remove(p);
            System.out.printf("%d\t", t);
        }
    }

    public static void main(String[] args) {
        ysf(10,3,3);
    }

}
